package crudfx.field;
import javafx.scene.paint.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class ArtBooleanField extends BooleanField{
    public var icon:javax.swing.Icon;
    public var selectedIcon:javax.swing.Icon;
    override var value on replace{setStateIcon();};
    public var color:Color=Color.web("#000000") on replace{
        jCheckBox.setForeground(new java.awt.Color(color.red,color.green,color.blue,color.opacity));
        };
    public-init var bold:Boolean=false;
    public-init var italic:Boolean=false;
    public-init var serifs:Boolean=false;
    public-init var monospaced:Boolean=false;
    public-init var size:Number=9;
    function setStateIcon(){
        if(value){jCheckBox.setIcon(selectedIcon);}
        else{jCheckBox.setIcon(icon);}
    }
    init{
        jCheckBox.setForeground(new java.awt.Color(color.red,color.green,color.blue,color.opacity));
        var fn:String="SansSerif";
        if(monospaced)fn="Monospaced";
        if(serifs)fn="Serif";
        var fst:Integer=0;
        if(bold)fst=fst+java.awt.Font.BOLD;
        if(italic)fst=fst+java.awt.Font.ITALIC;
        var font:java.awt.Font=new java.awt.Font(fn,fst,size);
        jCheckBox.setFont(font);
        setStateIcon();
        }
}
